package com.ys.nms.module.business.dal.mysql.alertLog;

import java.util.*;

import com.ys.nms.framework.common.pojo.PageResult;
import com.ys.nms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ys.nms.framework.mybatis.core.mapper.BaseMapperX;
import com.ys.nms.module.business.dal.dataobject.alertLog.AlertLogDO;
import org.apache.ibatis.annotations.Mapper;
import com.ys.nms.module.business.controller.admin.alertLog.vo.*;

/**
 * 报警日志 Mapper
 *
 * @author zzy
 */
@Mapper
public interface AlertLogMapper extends BaseMapperX<AlertLogDO> {

    default PageResult<AlertLogDO> selectPage(AlertLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AlertLogDO>()
                .eqIfPresent(AlertLogDO::getId, reqVO.getId())
                .eqIfPresent(AlertLogDO::getRuleId, reqVO.getRuleId())
                .eqIfPresent(AlertLogDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(AlertLogDO::getState, reqVO.getState())
                .eqIfPresent(AlertLogDO::getDetails, reqVO.getDetails())
                .eqIfPresent(AlertLogDO::getTimeLogged, reqVO.getTimeLogged())
                .orderByDesc(AlertLogDO::getId));
    }

}